package com.klb.tools;

import org.apache.struts2.ServletActionContext;

import javax.servlet.http.HttpSession;

/**
 * Created by fujia on 2016/5/28.
 */
public class Sessions {
    public static void setSession(String name, Object value){
        HttpSession session = ServletActionContext.getRequest().getSession();
        session.setAttribute(name, value);
    }

    public static Object getSession(String name){
        HttpSession session = ServletActionContext.getRequest().getSession();
        return (Object) session.getAttribute(name);
    }

    public static void removeSession(String name){
        HttpSession session = ServletActionContext.getRequest().getSession();
        session.removeAttribute(name);
    }
}
